/**
 * ifuner 制作 @18658226071@163.com
 *
 * @format
 */

"use strict"
import store from "_store"

const permission = {
	hasPermission: key => {
		let { site_admin = false, status = {}, auth_key = [] } = store.state.auth.userData
		if (site_admin) {
			return true
		} else {
			return status !== 2 && auth_key.some(item => item === key)
		}
	},
	routerHasPermission: (metaKey = "") => {
		if (metaKey) {
			return permission.hasPermission(metaKey)
		} else {
			return true
		}
	}
}

export default permission
